package DeepClone;

/**
 * @Author Big_white
 * @Date 2021/10/31
 */
public class Client {
    public static void main(String[] args) throws Exception{
        DeepProtoType p=new DeepProtoType();
        p.name="宋江";
        p.deepCloneableTarget=new DeepCloneableTarget("大牛","小牛");

        //方法一 完成深拷贝
        DeepProtoType p2=(DeepProtoType) p.clone();
        System.out.println(p.name+"  "+p.deepCloneableTarget.hashCode());
        System.out.println(p2.name+"  "+p2.deepCloneableTarget.hashCode());

        //方式二 完成深拷贝
        DeepProtoType p3=(DeepProtoType) p.deepClone();
        System.out.println(p.name+"  "+p.deepCloneableTarget.hashCode());
        System.out.println(p3.name+"  "+p3 .deepCloneableTarget.hashCode());

    }
}
